#ifndef  M_USART_H
#define  M_USART_H
#include "stm32f10x.h"
#include <stdio.h>



#ifdef __GNUC__
  /* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf
     set to 'Yes') calls __io_putchar() */
  #define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
  #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endif /* __GNUC__ */


#define USARTy                   USART2
#define USARTy_GPIO              GPIOA
#define USARTy_CLK               RCC_APB1Periph_USART2
#define USARTy_GPIO_CLK          RCC_APB2Periph_GPIOA
#define USARTy_RxPin             GPIO_Pin_3
#define USARTy_TxPin             GPIO_Pin_2
#define USARTy_Tx_DMA_Channel    DMA1_Channel7
#define USARTy_Tx_DMA_FLAG       DMA1_FLAG_TC7
#define USARTy_Rx_DMA_Channel    DMA1_Channel6
#define USARTy_Rx_DMA_FLAG       DMA1_FLAG_TC6 
#define USARTy_DR_Base           0x40004404
#define USARTy_IRQn              USART2_IRQn

#define    RxBufferSize1   64


//#define WITH_USB
#define WITH_USART


void My_Usart_Init();
void iNEMO_USART_SENTDATA(u8 *data_buffer, u8 Nb_bytes);
void Delay2(int i);
#endif